import { createStore } from 'vuex'
// 通信需要的数据
export default createStore({
  // 通信数据
  state: {
    isLogin: false,
    userInfo: {
      userId: 0,
      roleId: 0,
      role: '',
      username: '',
      nickname: '',
      phone: '',
      avatar: '',
      synopsis: '',
      academy: '',
      token: ''
    },
    comment: {
      userId: 0,
      content: '',
      replyContent: 0,
      replyId: 0,
      replyUserId: 0,
      topId: 0,
      replyCommentId: 0,
      likeNum: 0
    },
    isRaceWorks: false,
  },
  // 通信数据传入方式
  getters: {
  },
  // 通信方法
  mutations: {
    setLoginState(state, value) {
      state.isLogin = value
    },
    setUserInfo(state, value) {
      state.userInfo = value
    },
    setCommentProperty(state, { key, value }) {
      state.comment[key] = value;
    },
    setRaceWorksState(state, value) {
      state.isRaceWorks = value
    }

  },
  // 异步通信方法
  actions: {
  },
  modules: {
  }
})